/**
 * UVa 10010 Where's Waldorf
 * Author: chchwy (a) gmail.com
 * Last modified: 2010.05.07
 */
#include<iostream>
#include<cstdio>

enum {MAX=50+5};

void find(char match[MAX], grid[MAX][MAX], int m, int n){

    for(int i=0;i<m;++i){
        for(int j=0;j<n;++j){


        }
    }
}

void eachCase(){

    char grid[MAX][MAX];
    memset(grid,0,sizeof(grid));

    int m,n;
    scanf("%d%d", &m,&n);

    //read grid
    for(int i=0;i<m;++i)
        scanf("%s", grid[i]);

    int numWords;
    scanf("%d", numWords);
    while(numWords--){
        char match[MAX];
        scanf("%s", match);
        find(match, grid, m, n);
    }
}

int main(){

    int caseNum;
    scanf("%d", &caseNum);

    while(caseNum--){
        eachCase();
        if(caseNum>0) putchar('\n'); //seperated blank line
    }
    return 0;
}
